package shape;

import java.awt.Color;

import color.ColorCheck;

/**
 * Implements Line object
 * */
public class Line
{
    
    // Attributes of the Line objects
    private double x1;
    private double y1;
    private double x2;
    private double y2;
    private Color  stroke;
    private double strokeWidth;
    ColorCheck     ck = new ColorCheck();
    
    /**
     * 
     * @param x1
     *            horizontal distance to line start position from (0,0)
     * @param y1
     *            vertical distance to line start position from (0,0)
     * @param x2
     *            horizontal distance to line end position from (0,0)
     * @param y2
     *            vertical distance to line end position from (0,0)
     */
    public Line(double x1, double y1, double x2, double y2)
    {
        
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
    }
    
    /**
     * 
     * @param x1
     *            horizontal distance to line start position from (0,0)
     * @param y1
     *            vertical distance to line start position from (0,0)
     * @param x2
     *            horizontal distance to line end position from (0,0)
     * @param y2
     *            vertical distance to line end position from (0,0)
     * @param strokeWidth
     *            stroke Width of the line
     */
    public Line(double x1, double y1, double x2, double y2, double strokeWidth)
    {
        
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
        this.strokeWidth = strokeWidth;
        this.stroke = Color.red;
    }
    
    /**
     * 
     * @param x1
     *            horizontal distance to line start position from (0,0)
     * @param y1
     *            vertical distance to line start position from (0,0)
     * @param x2
     *            horizontal distance to line end position from (0,0)
     * @param y2
     *            vertical distance to line end position from (0,0)
     * @param stroke
     *            color of the line
     * @param strokeWidth
     *            stroke Width of the line
     */
    public Line(double x1, double y1, double x2, double y2, String stroke,
            double strokeWidth)
    {
        
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
        this.strokeWidth = strokeWidth;
        
        this.stroke = ck.getColor(stroke);
        
    }
    
    /**
     * @return x1 in pixels
     */
    public double getX1()
    {
        return x1;
    }
    
    /**
     * @return y1 in pixels
     */
    public double getY1()
    {
        return y1;
    }
    
    /**
     * @return x2 in pixels
     */
    public double getX2()
    {
        return x2;
    }
    
    /**
     * @return y2 in pixels
     */
    public double getY2()
    {
        return y2;
    }
    
    /**
     * @return Stroke Color as Color
     */
    public Color getStrokeColor()
    {
        return stroke;
    }
    
    /**
     * @return Stroke width in pixels
     */
    public double getStrokeWidth()
    {
        return strokeWidth;
    }
    
    // Prints Line details for debugging
    public void print()
    {
        
        System.out.println("Line");
        System.out.println("x1  = " + this.x1);
        System.out.println("y1  = " + this.y1);
        System.out.println("x2 = " + this.x2);
        System.out.println("y2 = " + this.y2);
        System.out.println("stroke = " + this.stroke);
        System.out.println("strokeWidth = " + this.strokeWidth);
        
    }
    
}
